#include "ipextend.h"


IPExtend::IPExtend(QString ip):ip_addr(ip)
{

}

QString IPExtend::get_ip()
{
    QStringList splitIP=ip_addr.split(":");
    if(splitIP.count()==2)
    {
        return splitIP.at(0);
    }
    else
    {
        return "127.0.0.0";
    }
}

QString IPExtend::get_port()
{
    QStringList splitIP=ip_addr.split(":");
    if(splitIP.count()==2)
    {
        return splitIP.at(1);
    }
    else
    {
        return "1234";
    }
}


bool IPExtend::Valid(QString ip)
{
    return ip.split(":").count()==2;
}
